import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import 'element-ui/lib/theme-chalk/index.css';
import './assets/fonts/iconfont.css';
import './assets/css/global.css'

//  引入ElementUI
import ElementUI from 'element-ui';
Vue.use(ElementUI);

// 引入axios
import axios from 'axios'
import VueAxios from 'vue-axios'
// 配置请求的根路径
axios.defaults.baseURL='http://127.0.0.1:8888/api/private/v1/'

Vue.prototype.axios=axios


// interceptors  拦截器 --作用：预处理请求
// config 请求的对象
// Authorization token验证的字段
axios.interceptors.request.use(config=>{
  console.log(config);
  config.headers.Authorization=window.sessionStorage.getItem('token')
  // 最后必须return config
  return config;
})

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
